#!/usr/bin/python
# -*- coding:UTF-8 -*-

list1 = ['physics', 'chemistry', 1997, 2000]
list2 = [1, 2, 3, 4, 5, 6, 7]
print ("list1[0] = ", list1[0])
print("list2[1:5] = ", list2[1:5])

list3 = []
list3.append('Google')
list3.append('Runoob')
print(list3)

print(list1)
del list1[2]
print(list1)

print(len([1,2,3]))
print([1, 2, 3] + [4, 5, 6])
print("Hi!" * 4)
print(3 in [1, 2, 3])
for x in [1, 2, 3]:
    print (x),
print("")

L = ['Google', 'Runoob', 'Taobao']
print(L[2])
print(L[-2])
print(L[1:])

list1, list2 = [123, 'xyz'], [456, 'abc']
print(cmp(list1, list2))
print(cmp(list2, list1))
list2 += [786]
print(list2)
print(cmp(list2, list3))
print(len(list1))
print(len(list2))
print(max(list1), max(list2))
print(min(list1), min(list2))

aTuple = (123, 'xyz', 'zara', 'abc')
aList = list(aTuple)
print(aList, type(aList), type(aTuple))

aList = [123, 'xyz', 'zara', 'abc', 123]
aList.append(2009)
print(aList)
aList.append(['a', 'b', 'c'])
aList.extend(['d', 'e', 'f'])
print(aList)

print(aList.count(123))
print(aList.count('zara'))

print(aList.index('xyz'))
print(aList.index('xyz', 1, 3))

aList.insert(3, 2009)
print(aList)

list4 = ['Google', 'Runoob', 'Taobao']
list_pop = list4.pop(1)
print(list4, list_pop)

print(aList)
aList.remove('xyz')
print(aList)
aList.remove('abc')
print(aList)

aList.reverse()
print(aList)

aList = [123, 'Google', 'Runoob', 'Taobao', 'Facebook']
aList.sort()
print(aList)

print([(x,y) for x in [1,2] for y in [3,4]])